import Vue from 'vue'
import VueRouter, {RouteConfig} from 'vue-router'

Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
    // 一级路由
    {
        path: '/login',
        name: 'login',
        component: () => import('../views/login/loginindex.vue')
    },
    {
        path: "/404",
        component: () => import(/* webpackChunkName: "404" */ "@/views/404.vue"),
        meta: { title: "恒利酒行", hidden: true, notNeedAuth: true }
    },
    {
        path: '/',
        name: 'layout',
        redirect: '/home',
        component: () => import('../layout/Layout.vue'),
        children: [
            {
                path: 'home',
                name: 'home',
                // redirect:'dashboard',
                component: () => import('../views/dashboard/index.vue')
            },
            {
                path: 'statistics',
                name: 'statistics',
                component: () => import('../views/statistics/index.vue')
            },
            {
                path: 'order',
                name: 'order',
                component: () => import('../views/orderDetails/index.vue')
            },
            {
                path: 'winepackage',
                name: 'winepackage',
                component: () => import('../views/winepackage/winepackage.vue')
            },
            {
                path: "winepackage/add",
                component: () =>
                    import("@/views/winepackage/addWinepackage.vue"),
                meta: {
                    title: "添加套餐",
                }
            },
            {
                path: 'category',
                name: 'category',
                component: () => import('../views/category/category.vue')
            },
            {
                path: "category/add",
                component: () =>
                    import("@/views/category/addCategory.vue"),
                meta: {
                    title: "添加分类",

                }
            },
            {
                path: 'wine',
                name: 'wine',
                component: () => import('../views/wine/wine.vue')
            },
            {
                path: "wine/add",
                component: () =>
                    import("@/views/wine/addWineSingle.vue"),
                meta: {
                    title: "添加酒品",
                }
            },
            {
                path: 'employee',
                name: 'employee',
                component: () => import('../views/employee/employee.vue')
            },
            {
                path: "employee/add",
                component: () =>
                    import("@/views/employee/addEmployee.vue"),
                meta: {
                    title: "添加员工",

                }
            }
        ]
    },
    {
        path: "*",
        redirect: "/404",
        meta: { hidden: true }
    }
]

const router = new VueRouter({
    routes
})

export default router